SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_AddTab] 
    @ContentItemID			int,
    @PortalID				int,
    @TabOrder				int,
    @UniqueId				uniqueidentifier,
    @VersionGuid			uniqueidentifier,
    @DefaultLanguageGuid	uniqueidentifier,
    @LocalizedVersionGuid	uniqueidentifier,
    @TabName				nvarchar(50),
    @IsVisible				bit,
    @DisableLink			bit,
    @ParentId				int,
    @IconFile				nvarchar(100),
    @IconFileLarge			nvarchar(100),
    @Title					nvarchar(200),
    @Description			nvarchar(500),
    @KeyWords				nvarchar(500),
    @Url					nvarchar(255),
    @SkinSrc				nvarchar(200),
    @ContainerSrc			nvarchar(200),
    @StartDate				datetime,
    @EndDate				datetime,
    @RefreshInterval		int,
    @PageHeadText			nvarchar(Max),
    @IsSecure				bit,
    @PermanentRedirect		bit,
    @SiteMapPriority		float,
    @CreatedByUserID		int,
    @CultureCode			nvarchar(50)

AS
    INSERT INTO dbo.DnnProduct_Tabs (
        ContentItemID,
        PortalID,
        TabOrder,
        UniqueId,
        VersionGuid,
        DefaultLanguageGuid,
        LocalizedVersionGuid,
        TabName,
        IsVisible,
        DisableLink,
        ParentId,
        IconFile,
        IconFileLarge,
        Title,
        Description,
        KeyWords,
        IsDeleted,
        Url,
        SkinSrc,
        ContainerSrc,
        StartDate,
        EndDate,
        RefreshInterval,
        PageHeadText,
        IsSecure,
        PermanentRedirect,
        SiteMapPriority,
        CreatedByUserID,
        CreatedOnDate,
        LastModifiedByUserID,
        LastModifiedOnDate,
        CultureCode
    )
    VALUES (
        @ContentItemID,
        @PortalID,
        @TabOrder,
        @UniqueId,
        @VersionGuid,
        @DefaultLanguageGuid,
        @LocalizedVersionGuid,
        @TabName,
        @IsVisible,
        @DisableLink,
        @ParentId,
        @IconFile,
        @IconFileLarge,
        @Title,
        @Description,
        @KeyWords,
        0,
        @Url,
        @SkinSrc,
        @ContainerSrc,
        @StartDate,
        @EndDate,
        @RefreshInterval,
        @PageHeadText,
        @IsSecure,
        @PermanentRedirect,
        @SiteMapPriority,
        @CreatedByUserID,
        getdate(),
        @CreatedByUserID,
        getdate(),
        @CultureCode
    )
	DECLARE @TabId INT
    SELECT @TabId = SCOPE_IDENTITY()
    EXEC dbo.DnnProduct_BuildTabLevelAndPath @TabId
	SELECT @TabId
    RETURN @TabId
GO
